import { userInfo, tableData } from '@/mock/user'
import { menu } from '@/mock/menu'
import request from '@/router/axios'
export const loginByUsername = (username, password) => {
  return request({
    url: `/login`,
    method: 'post',
    headers: {
      serialize: true
    },
    data: {
      username,
      password
    }
  })
}
export const getOrg = jgbh => {
  return request({
    url: `/ykdjgxxs/find`,
    method: 'post',
    data: { jgbh: jgbh }
  })
}

export const getUserInfo = () => {
  return new Promise(resolve => {
    resolve({ data: userInfo })
  })
}
export const RefeshToken = () => {
  return new Promise(resolve => {
    resolve({ data: new Date().getTime() })
  })
}

export const getMenu = parentId => {
  return new Promise(resolve => {
    if (parentId != 1) parentId = 0
    resolve({ data: menu[parentId] })
  })
}
export const getMenuAll = () => {
  return new Promise(resolve => {
    resolve({ data: menu[0] })
  })
}

export const getTableData = page => {
  console.log(page)
  return new Promise(resolve => {
    resolve({ data: tableData })
  })
}
export const logout = () => {
  return new Promise(resolve => {
    resolve()
  })
}
